package edu.scut.course_management.dao;

import edu.scut.course_management.po.Resource;
import org.apache.ibatis.annotations.Param;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 数据访问，对应库表：resource
 * @author shawshank
 */
@Repository
public interface ResourceMapper {

	// 根据资源结点ID查询课程资源
	Resource findResourceByNodeId(@Param("nodeId") Integer nodeId);

	// 创建资源结点
	void createResourceNode(Resource resource) throws DataAccessException;

	// 找到孩子结点
	List<Resource> getChildren(@Param("parentNodeId") Integer parentNodeId);

	// 删除资源结点
	void deleteResourceNode(@Param("deletingResourceNodeId") Integer deletingResourceNodeId);

}
